/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!				\file		CC_Block.h
				\date		june 2010
				\author		TNick

				\brief		Contains the definition of CC_Block class and related


	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Please read ReadMe.txt and Licence.txt in root folder
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef		__CC_Block_INC__
#define		__CC_Block_INC__
#ifdef		__cplusplus
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<generic/cc_l2dn.h>
#include	<base/CC_Err.h>
#include	<base/uni_prp/PrpAgreg.h>
#include	<base/uni_prp/PrpHost.h>

/*  INCLUDES    ============================================================ */
//
//
//
//


/// Class representing a block
/**
*	Inherited class CC_L2DN manages the chain of blocks in a drawing and the
*	name of this block.
*	PrpHost is an abstract class allowing generic management for
*	contained properties.
*/
class	CC_Block	: public CC_L2DN, public PrpHost  {


	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */


	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

	/// list of graphical and non-graphical items
	CC_HDL2D			Items;



	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */

public:
	/// constructor
	CC_Block();

	/// destructor; will free resources;
	virtual ~CC_Block();


	/* >>>>>>>>>>>>>>>>>>>>>>>>>>>   PrpHost   <<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
	/// get the list of properties a a list of pointers to PrpAgreg instances
	/**
	*	@return		array allocated using new[]; the ownership of the array
		 passes to caller; may be NULL for memory failures or if the item
		 has no properties
	*/
	virtual PrpAgreg**	propList		(
		int*		p_count	/**< pointer to variable that recives
		the number of elements in the list */
	) { *p_count = 0; return NULL; }


	/// informs the item about a chnge in properties
	/**
	*	the item must determine inside if it supports this property and,
	*	if it does, shall update it's value. If the item does not support
	*	this feature, it should silently ignore this call.
	*/
	virtual void		propChanged		(
		PrpAgreg*	p_new_val	/**< pointer to changed value */
	) { Q_UNUSED(p_new_val); }



	/* >>>>>>>>>>>>>>>>>>>>>>>>>>>  FILE I/O   <<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
	/// saves the data regarding this class to a stream in CASP_1 format
	/*
	*	@return		true all went OK; false some went wrong
	*/
	CCERR::EERRORS	Save_CASP_1	(QDataStream* pStream, CC_Err* pErr);

	/// loads the data regarding this class from a stream in CASP_1 format
	/*
	*	@return		true all went OK; false some went wrong
	*/
	CCERR::EERRORS	Load_CASP_1	(QDataStream* pStream, CC_Err* pErr);


	/// saves the data regarding this class to a stream in DXF format
	/*
	*	@return		true all went OK; false some went wrong
	*/
	CCERR::EERRORS	Save_DXF	(QDataStream* pStream, CC_Err* pErr);

	/// loads the data regarding this class from a stream in DXF format
	/*
	*	@return		true all went OK; false some went wrong
	*/
	CCERR::EERRORS	Load_DXF	(QDataStream* pStream, CC_Err* pErr);




	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class	CC_Block	*/
//
//
//
//
#endif	//	__cplusplus
#endif	//	__CC_Block_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
